package com.yb.sys.user.controller;

import com.yb.core.bean.Resp;
import com.yb.sys.user.repository.StudentsDao;
import com.yb.sys.user.service.IStudentService;
import com.yb.sys.user.vo.PageReq;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * Copyright (C), 2022-2022, 姚兵
 * Author: 32210
 * Date: 2022/11/23 14:10
 * FileName: StudentController
 * Description:
 */
@RestController
@RequestMapping("student")
public class StudentController {

    @Autowired
    StudentsDao studentsDao;

    @Autowired
    IStudentService studentService;

    @RequestMapping("list")
    public Resp list(){
        return Resp.ok().data(studentsDao.findAll());
    }


    @RequestMapping("page")
    public Resp page(@RequestBody PageReq pageRequest){
        return Resp.ok().data(studentService.page(pageRequest));
    }
    @RequestMapping("init")
    public Resp init(){

        return studentService.init();
    }
}
